package com.xvheng.module.backendApi.service.impl;

import java.util.List;
import com.xvheng.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xvheng.module.backendApi.mapper.UserCouponMapper;
import com.xvheng.module.backendApi.domain.UserCoupon;
import com.xvheng.module.backendApi.service.IUserCouponService;

/**
 * 会员卡券Service业务层处理
 * 
 * @author xvheng
 * @date 2025-01-03
 */
@Service
public class UserCouponServiceImpl implements IUserCouponService 
{
    @Autowired
    private UserCouponMapper userCouponMapper;

    /**
     * 查询会员卡券
     * 
     * @param id 会员卡券主键
     * @return 会员卡券
     */
    @Override
    public UserCoupon selectUserCouponById(String id)
    {
        return userCouponMapper.selectUserCouponById(id);
    }

    /**
     * 查询会员卡券列表
     * 
     * @param userCoupon 会员卡券
     * @return 会员卡券
     */
    @Override
    public List<UserCoupon> selectUserCouponList(UserCoupon userCoupon)
    {
        return userCouponMapper.selectUserCouponList(userCoupon);
    }

    /**
     * 新增会员卡券
     * 
     * @param userCoupon 会员卡券
     * @return 结果
     */
    @Override
    public int insertUserCoupon(UserCoupon userCoupon)
    {
        userCoupon.setCreateTime(DateUtils.getNowDate());
        return userCouponMapper.insertUserCoupon(userCoupon);
    }

    /**
     * 修改会员卡券
     * 
     * @param userCoupon 会员卡券
     * @return 结果
     */
    @Override
    public int updateUserCoupon(UserCoupon userCoupon)
    {
        userCoupon.setUpdateTime(DateUtils.getNowDate());
        return userCouponMapper.updateUserCoupon(userCoupon);
    }

    /**
     * 批量删除会员卡券
     * 
     * @param ids 需要删除的会员卡券主键
     * @return 结果
     */
    @Override
    public int deleteUserCouponByIds(String[] ids)
    {
        return userCouponMapper.deleteUserCouponByIds(ids);
    }

    /**
     * 删除会员卡券信息
     * 
     * @param id 会员卡券主键
     * @return 结果
     */
    @Override
    public int deleteUserCouponById(String id)
    {
        return userCouponMapper.deleteUserCouponById(id);
    }
}
